package servlet;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import fachada.Fachada;
import model.Pessoa;

public class ListarAniversarios extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7428665963003055671L;

	@Override
	protected void doPost(HttpServletRequest request, 
						  HttpServletResponse response)
						  throws ServletException, IOException {
		
		Fachada f = new Fachada();
		HttpSession session = request.getSession();
		Pessoa p = (Pessoa) session.getAttribute("pessoa");
		//ArrayList<Pessoa> aniversarios =  p.getRelacionamentos();
		ArrayList<Pessoa> aniversarios = f.listarAniversarios(p);
				
		session.setAttribute("aniversarios", aniversarios);
	    RequestDispatcher rd = request.getRequestDispatcher("aniversarios.jsp");
		rd.forward(request, response);
		
	}
	
}
